//
//  GlobalDefinition.h
//  360FM
//
//  Created by ltl on 15-5-23.
//  Copyright (c) 2015年 cangding. All rights reserved.
//

#ifndef muzhifm_GlobalDefinition_h
#define muzhifm_GlobalDefinition_h

#import "BaseWebViewController.h"
#import "AppDelegate.h"
//判断屏幕大小
#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6P ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

#pragma mark - 判断系统版本号
#define IS_OS_7  (([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)&&([[[UIDevice currentDevice] systemVersion] floatValue] < 7.9))
#define IS_OS_7_OR_LATER  (([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0))
#define IS_OS_8_OR_LATER  ([[[UIDevice currentDevice] systemVersion] floatValue] > 7.9)

#pragma mark - 判断设备
# define IS_IPHONE5  ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
#define IS_IPHONE4 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )480 ) < DBL_EPSILON )


#pragma mark - 全局的frame标注
#define ScreenSize  ([UIScreen mainScreen].bounds.size)
#define SCREEN_WIDTH  ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define NAVIGATION_BAR_HEIGHT ([UIScreen mainScreen].bounds.size.height == 812.0 ? 88:64)
#define StatusBar_Height ([UIScreen mainScreen].bounds.size.height == 812.0 ? 44.0:20.0)

#define navBarHieght 64
#define tabBarHieght 49


#define RGB(r,g,b) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:1]

#define UIColorFromRGB(rgbValue,alphaValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue]

#pragma mark -公用的全局控件颜色
#pragma mark 分割线
#define LINECOLOR UIColorFromRGB(0xE4E8EC, 1.0)
#pragma mark 背景
#define BACKGROUNDCOLOR UIColorFromRGB(0xefeef3, 1.0)
#pragma mark 红色
#define THEMECOLOR UIColorFromRGB(0xC03636, 1.0)// 主题色
#define REDCOLOR UIColorFromRGB(0xDD2118, 1.0)// 涨
#define REDCOLORHIG UIColorFromRGB(0xAC3030, 1.0)// 红色按钮按下颜色
#pragma mark 黑色
#define BLACKCOLOR1 UIColorFromRGB(0x323232, 1.0)// 字体颜色1
#define BLACKCOLOR2 UIColorFromRGB(0x686868, 1.0)// 字体颜色2
#define BLACKCOLOR3 UIColorFromRGB(0x989898, 1.0)// 字体颜色3
#pragma mark 白色
#define WHITECOLORNORMAL UIColorFromRGB(0xFEFEFE, 1.0)
#define WHITECOLORDISABLE UIColorFromRGB(0xE0E0E0, 1.0) //不可点击按钮
#define WHITECOLORHIGH UIColorFromRGB(0xE5E5E5, 1.0)//白色按钮按下
#define WHITECOLORLABEL UIColorFromRGB(0xFFFFFF, 1.0)// 字体颜色
#define WHITECOLORLABELAlpha UIColorFromRGB(0xFFFFFF, 0.7) // 字体带透明度

#define WEAKSELF typeof(self) __weak weakSelf = self;

#pragma mark - 单例模版宏

#undef	AS_SINGLETON
#define AS_SINGLETON( __class ) \
+ (__class *)sharedInstance;

#undef	DEF_SINGLETON
#define DEF_SINGLETON( __class ) \
+ (__class *)sharedInstance \
{ \
static dispatch_once_t once; \
static __class * __singleton__; \
dispatch_once( &once, ^{ __singleton__ = [[__class alloc] init]; } ); \
return __singleton__; \
}

#endif
